<template>
    <Card>
        <div id="charts" style="width: 100%;height: 500px"></div>
    </Card>
</template>

<script>
    //import echart from 'echarts'
    import fetch from '../../utils/fetch'
    var echarts = require('echarts');


    export default {
        name: 'FactorySale',
        data:{

        },
        methods:{

        },
        mounted:function () {
            fetch({
                url:"/stat/factorySale",
                method:"get"
            }).then(resp=>{
                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById('charts'));
                // 绘制图表
                myChart.setOption({
                    title: {
                        text: '厂家销售情况统计'
                    },
                    tooltip: {},
                    xAxis: {
                        data: resp.data.titles
                    },
                    yAxis: {},
                    series: [{
                        name: '销量',
                        type: 'bar',
                        data: resp.data.values
                    }]
                });
            })
        }

    };
</script>

<style scoped>

</style>
